Sensory representations in the brain and an animal?s perception change in many ways over many time scales. Over tens or hundreds of milliseconds, ongoing neuronal activity contributes substantially to response variability in primary sensory areas. Effort and arousal typically vary over seconds or minutes, and are also associated with major changes in sensory representations and behavioral performance. Perceptual learning occurs over hours and days, imparting new perceptual capabilities. Working with all these forms of variability in stimulus processing, the brain maintains (in the case of ongoing activity) and improves (in the case of arousal and learning) behavioral outcomes. It is commonly assumed that maintenance and improvements in behavioral outcome depend primarily on changes in the corresponding sensory representation, yet this is far from certain. New methods of two-photon stimulation are ideal for probing how much the contributions of different cortical neurons change across behavioral states or as animals learn new perceptual tasks. The proposed experiments take advantage of the experimental accessibility of stimulus-response associations in primary sensory cortices to identify mechanisms and principles in neuronal circuits that maintain and improve behavioral outcome in the context of brain state changes over many timescales. These studies will test whether the high spatiotemporal variability of ongoing activity reflects higher-order statistics of neuronal population activity that ensure the most informative stimulus processing and best behavioral outcomes. The impact of effort and arousal will be addressed at cellular resolution by identifying changes in population representations and readout in primary sensory cortex between different behavioral states and during saccadic suppression. Perceptual learning experiments will probe the contributions to behavioral performance of individual neurons in the olfactory bulb, primary auditory cortex, and primary visual cortex, and determine how those contributions change and can be manipulated over the course of perceptual learning. Collectively, these experiments will provide a far more precise and granular view of how sensory representations vary over different time scales, and new information on how the decoding of those representations can change over time.